<%--
  Created by IntelliJ IDEA.
  User: King_long
  Date: 2019-10-15
  Time: 13:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>发布页面</title>
    <style>
        input {
            border: 1px solid black;
        }
    </style>
    <link
        href="${pageContext.request.contextPath}/static/bootstrap-3.3.7-dist/bootstrap-3.3.7-dist/css/bootstrap.min.css"
        rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/bootstrap-3.3.7-dist/bootstrap-3.3.7-dist/js/bootstrap.js">

    <script src="../../static/js/jquery-1.8.3.js"></script>

</head>
<body>
<div class="row col-md-4 col-md-offset-5">
    <h3><a href="#">发布</a></h3>
    <h3><a href="${pageContext.request.contextPath}/fuzzysearchpage">模糊查询</a></h3>
    <form action="${pageContext.request.contextPath}/add" method="post" onsubmit="return panduan()">
        <label>电影名称：</label><input type="text" name="filmName"/>
        <span id="warn" style="display: none;color: #d43f3a">电影名不能为空</span><br>
        <label>电影类型：</label><select name="typeId"><br>
        <c:forEach items="${filmTypes}" var="filmType">
            <option value="${filmType.typeId}" name="${filmType.typeId}">${filmType.typeName}</option>
        </c:forEach>
    </select><br>
        <label>主演：</label><input type="text" name="actor"/><br>
        <label>导演：</label><input type="text" name="director"/><br>
        <label>价格：</label><input id="price" type="text" name="ticketPrice" placeholder="价钱不能小于50"/>
        <span id="warn2" style="display: none;color: #d43f3a">价钱输入异常</span><br>
        <label>发布：</label><input id="sub" type="submit" value="发布"/><br>
    </form>
    <br>
</div>
</body>
<script>
    $(function () {
        $('input').focus(function () {
            $('span').css("display", "none");
            $('input').css("border-color", "black");
        });
        $('#sub').click(function panduan() {
            var price = parseInt($('#price').val());
            if ($("input[name='filmName']").val() == "") {
                $("input[name='filmName']").css("border-color", "red");
                $('#warn').css("display", "");
                return false;
            }
            if ($("input[name='ticketPrice']").val() == "" || price < 50) {
                $("input[name='ticketPrice']").css("border-color", "red");
                $('#warn2').css("display", "");
                return false;
            }

        });

    });
</script>
</html>
